#include <iostream>
#include <map>
#include <string>
//
// Created by Administrator on 2025/9/4.
//
int main()
{
    // more verbose way to count number of times each word occurs in the input
    std::map< std::string, size_t> word_count; // empty map from string to size_t
    std::string word;
    while (std::cin >> word) {
        // inserts an element with key equal to word and value 1;
        // if word is already in word_count, insert does nothing
        auto ret = word_count.insert({word, 1});
//         std::pair<std::map<std::string, size_t>::iterator, bool> ret =
// word_count.insert(make_pair(word, 1));
        if (!ret.second) // word was already in word_count
            ++ret.first->second; // increment the counter
    }
    for (const auto& w : word_count) // for each element in the map
        // print the results
            std::cout << w.first << " occurs " << w.second
                << ((w.second > 1) ? " times" : " time") << std::endl;
}